From: Gerardo Esteban Malazdrewicz <gerardo@malazdrewicz.com.ar>
Date: Sat, 30 Dec 2017 12:32:29 -0400
Subject: linux415
Origin: https://bugs.debian.org/885885

linux 4.15 deprecated the init_timer function.

---
 amd64/src/wl/sys/wl_linux.c | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/amd64/src/wl/sys/wl_linux.c b/amd64/src/wl/sys/wl_linux.c
index 77dc327..ab7b883 100644
--- a/amd64/src/wl/sys/wl_linux.c
+++ b/amd64/src/wl/sys/wl_linux.c
@@ -93,7 +93,13 @@ struct iw_statistics *wl_get_wireless_stats(struct net_device *dev);
 
 #include <wlc_wowl.h>
 
-static void wl_timer(ulong data);
+static void wl_timer(
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
+		struct timer_list *tl
+#else
+		ulong data
+#endif
+		);
 static void _wl_timer(wl_timer_t *t);
 static struct net_device *wl_alloc_linux_if(wl_if_t *wlif);
 
@@ -2295,9 +2301,19 @@ wl_timer_task(wl_task_t *task)
 }
 
 static void
-wl_timer(ulong data)
-{
-	wl_timer_t *t = (wl_timer_t *)data;
+wl_timer(
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
+		struct timer_list *tl
+#else
+		ulong data
+#endif
+) {
+	wl_timer_t *t =
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
+		from_timer(t, tl, timer);
+#else
+		(wl_timer_t *)data;
+#endif
 
 	if (!WL_ALL_PASSIVE_ENAB(t->wl))
 		_wl_timer(t);
@@ -2349,9 +2365,13 @@ wl_init_timer(wl_info_t *wl, void (*fn)(void *arg), void *arg, const char *tname
 
 	bzero(t, sizeof(wl_timer_t));
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
+	timer_setup(&t->timer, wl_timer, 0);
+#else
 	init_timer(&t->timer);
 	t->timer.data = (ulong) t;
 	t->timer.function = wl_timer;
+#endif
 	t->wl = wl;
 	t->fn = fn;
 	t->arg = arg;
